<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
	    <meta content="telephone=no" name="format-detection" />
		<title>充值</title>
		<link href="{{asset('/mobile/css/style.css')}}" rel="stylesheet" type="text/css">
	</head>
	<style type="text/css">
		body{
			background-color: #F1F1F1;
			font-size: 18px;
		}
		.top-wrap{
			text-align: center;
			margin-top: 30%;
			margin-bottom: 60px;
		}
		.top-wrap img{
			width: 40%;
			margin-bottom: 5%;
		}
		.text1{
			font-size: 1.3rem;
			margin: 10px 0;
		}
		.text2{
			font-size: 2.5rem;
			margin: 10px 0;
		}
		.btn-big{
			text-align: center;
			background-color: #D9543B;
			border-radius: 5px;
			font-size: 1.1rem;
			padding: 0.7rem 0;
			color: #F9EAE7;
			width: 90%;
			margin: 50px auto 0;
		}
	</style>
	<body>
		<div class="top-wrap">
			<img src="/imgs/sureChong.png"/>
			<div class="text1">支付金额</div>
			<div class="text2">￥{{$amount}}</div>
		</div>
		<div class="btn-big" id="go" onclick="WXPayment()">确认支付</div>
		
		
    <script type="text/javascript" src="{{asset('/mobile/js/jquery-1.8.3.min.js')}}"></script>
    <script type="text/javascript" src="{{asset('/js/Inertia.js')}}"></script>
    <script type="text/javascript" src="{{asset('/js/backHome.js')}}"></script>
	<script type="text/javascript">
	var WXPayment = function() {
	    if( typeof WeixinJSBridge === 'undefined' ) {
	        alert('请在微信在打开页面！');
	        return false;
	    }
	    WeixinJSBridge.invoke(
	        'getBrandWCPayRequest',  <?= $json ?> , 
	        function(res) {
	            switch(res.err_msg) {
	                case 'get_brand_wcpay_request:cancel':
	                    alert('用户取消支付！');
	                    break;
	                case 'get_brand_wcpay_request:fail':
	                    alert('支付失败！（'+res.err_desc+'）');
	                    break;
	                case 'get_brand_wcpay_request:ok':
	                    location.href='/mobile/agent/paySuccess';
						break;
	                default:
	                    alert(JSON.stringify(res));
	                    break;
	            }
	        }
	    );
	}
	</script>
	</body>
</html>
